AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
 
include( 'shared.lua' )

function GM:PlayerInitialSpawn( ply )
 
    ply:ConCommand( "team_menu" )
 
end
 
function GM:PlayerLoadout( ply )
 
    if ply:Team() == 1 then
 
        ply:Give( "weapon_physcannon" )
		ply:Give( "gmod_tool" )
		ply:Give( "gmod_camera" )
	
	elseif ply:Team() == 2 then
		ply:Give( "weapon_pistol" )

 
    end
 
end

function team_1( ply )
 
    ply:SetTeam( 1 )
 
end
 
function team_2( ply )
 
    ply:SetTeam( 2 )
end
 
concommand.Add( "team_1", team_1 )
concommand.Add( "team_2", team_2 )

function GM:PlayerSelectSpawn( ply )
 
local spawns1 = ents.FindByClass( "info_player_start" )
     local random1 = math.random(#spawns)
local spawns2 = ents.FindByClass( "info_player_counterterrorist, info_player_terrorist, info_player_rebel, info_player_deathmatch" )
     local random2 = math.random(#spawns)
 
if ply:Team() == 1 then
	spawns1[random1]
elseif ply:Team() == 2 then
	spawns2[random2]

 end